package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SchedulingRecordMapper;
import com.ruoyi.system.domain.SchedulingRecord;
import com.ruoyi.system.service.ISchedulingRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 排班记录Service业务层处理
 * 
 * @author 华馨悦
 * @date 2025-01-24
 */
@Service
public class SchedulingRecordServiceImpl extends ServiceImpl<SchedulingRecordMapper,SchedulingRecord> implements ISchedulingRecordService

{
    @Autowired
    private SchedulingRecordMapper schedulingRecordMapper;

    /**
     * 查询排班记录
     * 
     * @param id 排班记录主键
     * @return 排班记录
     */
    @Override
    public SchedulingRecord selectSchedulingRecordById(Long id)
    {
        return schedulingRecordMapper.selectSchedulingRecordById(id);
    }

    /**
     * 查询排班记录列表
     * 
     * @param schedulingRecord 排班记录
     * @return 排班记录
     */
    @Override
    public List<SchedulingRecord> selectSchedulingRecordList(SchedulingRecord schedulingRecord)
    {
        return schedulingRecordMapper.selectSchedulingRecordList(schedulingRecord);
    }

    /**
     * 新增排班记录
     * 
     * @param schedulingRecord 排班记录
     * @return 结果
     */
    @Override
    public int insertSchedulingRecord(SchedulingRecord schedulingRecord)
    {
        return schedulingRecordMapper.insertSchedulingRecord(schedulingRecord);
    }

    /**
     * 修改排班记录
     * 
     * @param schedulingRecord 排班记录
     * @return 结果
     */
    @Override
    public int updateSchedulingRecord(SchedulingRecord schedulingRecord)
    {
        return schedulingRecordMapper.updateSchedulingRecord(schedulingRecord);
    }

    /**
     * 批量删除排班记录
     * 
     * @param ids 需要删除的排班记录主键
     * @return 结果
     */
    @Override
    public int deleteSchedulingRecordByIds(String ids)
    {
        return schedulingRecordMapper.deleteSchedulingRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 批量软删除排班记录
     *
     * @param ids 需要软删除的排班记录主键
     * @return 结果
     */
    @Override
    public int softDeleteSchedulingRecordByIds(String ids)
    {
        String[] strArray = Convert.toStrArray(ids);
        int count = 0;
        for (String s : strArray) {
            SchedulingRecord schedulingRecord = schedulingRecordMapper.selectSchedulingRecordById(Long.valueOf(s));
            schedulingRecord.setIsDelete(1);
            int i = schedulingRecordMapper.updateSchedulingRecord(schedulingRecord);
            count = count + i;
        }
        return count;
    }

    /**
     * 删除排班记录信息
     * 
     * @param id 排班记录主键
     * @return 结果
     */
    @Override
    public int deleteSchedulingRecordById(Long id)
    {
        return schedulingRecordMapper.deleteSchedulingRecordById(id);
    }
}
